﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.OMM.HealthMonitor.Entity.Common
{
    [Serializable()]
    public class ErrorData : IHealthDataReset
    {
        HealthEntityBase _healthEntityBase;
        public ErrorData()
        {
            _healthEntityBase = new HealthEntityBase();
        }

        public ErrorData(HealthEntityBase healthEntityBase)
        {
            _healthEntityBase = healthEntityBase;
        }

        private string _source;

        public string Source
        {
            get { return _source; }
            set
            {
                _source = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        private string _errorDescription;

        public string ErrorDescription
        {
            get { return _errorDescription; }
            set
            {
                _errorDescription = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        private string _errorCode;

        public string ErrorCode
        {
            get { return _errorCode; }
            set
            {
                _errorCode = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        private string _exceptionMessage;

        public string ExceptionMessage
        {
            get { return _exceptionMessage; }
            set
            {
                _exceptionMessage = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        private string _businessMessage;

        public string BusinessMessage
        {
            get { return _businessMessage; }
            set
            {
                _businessMessage = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        private string _procedureToTake;

        public string ProcedureToTake
        {
            get { return _procedureToTake; }
            set
            {
                _procedureToTake = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public void Reset()
        {
            this.Source = string.Empty;
            this.BusinessMessage = string.Empty;
            this.ErrorCode = string.Empty;
            this.ErrorDescription = string.Empty;
            this.ExceptionMessage = string.Empty;
            this.ProcedureToTake = string.Empty;
        }
    }
}
